package 日期与时间;

import java.time.LocalDate;
import java.time.Period;

public class period计算日期间隔 {
    public static void main(String[] args) {
        LocalDate bird=LocalDate.of(2003,4,13);
        LocalDate today=LocalDate.now();
        Period c=Period.between(bird,today);//前后需要同种类型后面减前面
        System.out.println(c.getYears());
        System.out.println(c.getDays());//年月日单独减年份月份不会影响日
        System.out.println(c.getMonths());
    }
}
